/**
 * MultiCollection is a collection of strings.
 * one can insert a string, and check if a string is in the set.
 * 
 * @author Bernhard Denner
 * @author Maximilian Csuk
 * @author Konrad Paumann
 */
package datastructures;

import java.util.ArrayList;
import java.util.Iterator;

public class MultiCollection implements ExistsCollection, InsertCollection {
	
	private ArrayList<String> list;
	
	public MultiCollection() {
		list = new ArrayList<String>();
	}
	
	/**
	 * checks if a string is in the collection
	 * returns 	true if the string is in the collection,
	 * 			false if the string is not in the collection
	 */ 
	public boolean exists(String s) {
		return list.contains(s);
	}
	
	/**
	 * Inserts a string in the collection. 
	 */
	public void insert(String s) {
		list.add(s);
	}
	
	/**
	 * Returns the size of the Collection
	 */
	public int getSize() {
		return list.size();
	}
	
	/**
	 * returns an iterator of the collection
	 * @return
	 */
	public Iterator<String> getIterator() {
		return list.iterator();
	}

}
